import axios from 'axios'
import $$ from './statusCode.config'
const httpAxios8081 = {}
httpAxios8081.install = function (Vue) {
  const instance = axios.create({
    baseURL: 'http://' + $$.heIp + ':8081/'
  })
  instance.interceptors.request.use(
    function (config) {
      if (sessionStorage.getItem('accessToken')) {
        config.headers.authorization = sessionStorage.getItem('refreshToken')
      }
      return config
    },
    function (error) {
      return Promise.reject(error)
    }
  )

  instance.interceptors.response.use(function (response) {
    return response
  })

  Vue.prototype.$refresh = instance
}
// export default httpHelper
export default httpAxios8081
